import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '@/pages/HomePage.vue'

import HomeRoutes from './home-routes.js'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/index',
    },
    {
      path: '/index/:id?',
      name: 'index',
      component: () => import('@/pages/IndexPage.vue'),
    },
    {
      path: '/home',
      name: 'home',
      component: HomePage,
      children: HomeRoutes,
    },
  ],
})

export default router
